import hashlib


class HashUtil(object):

    def sha256_hash(input_string):
        """
        对输入字符串进行 SHA-256 加密

        :param input_string: 需要加密的字符串
        :return: SHA-256 加密后的十六进制字符串
        """
        # 创建一个 sha256 哈希对象
        sha256 = hashlib.sha256()

        # 更新哈希对象的数据
        sha256.update(input_string.encode('utf-8'))

        # 获取哈希值的十六进制表示
        hashed_string = sha256.hexdigest()

        return hashed_string

    def getAppIdKey(input_string):
        """
        先定义一个键值对， 然后根据input_string的值来获取
        """
        params = {
            "22f869feeb224aceb1f2a375e8e7f554":"b3bcad3eb9f7407992773b679cad81d8",
            "78dda7eb15494c24b00b89cd9226e334":"69b533b884184ab9a89d987dafbc4186",
            "759e3e5b0b1f42e9867d310aa5e5fe97":"66582b1d9f75499c9d98f0acfbb0b702",
            "3294a3c1d6a94e448a9e5889cd7ae119":"1da52c6387994d319ea4e42355806085",
            "949a855a2f964c4f87dac3b18d20835d":"f908903b3bc044f595efd03c22d842ee",
            "3abbdb4a93d94ad0bffdb626a81b60f6":"738ba3aa4a9f492a9890e97b307f951a",
            "b51cd33c1bfd493fb20251e38dd4d328":"4a5c98aa90184a878092437e4c114da6",
            "8ca754be44d048aba39e810179815f24":"2c072ee2fdc74d68a7c5cb956d1e2e4a",
            "e8cb0b20cee24e36905a1f7d5b381ff2":"e5bd29b130a848908cd58a9da4557a28",
            "4488bf1ac01d4abfb7c41101cbd57514":"bb08830c31444567bf0360eb8a716c32",
            "04c56288c3aa43098bfb0c9d4b4fe7d3":"ae1acba4cc1c4956acfada38a15649d4",
            "5cba5f24765b4da8a10a99808444ab78":"0c382248079a4c58963fe21be9562b98",
            "752d5af867f94633970e259acfe61da9":"4cd6a8a76cb54c87871e1e37ccedb59e",
            "83c8c3304b744aaeb07db170489616e2":"009337b3399e457893893fa29809742a",
            "9d0da640fe374ac3a1af47485bb20ee9":"fdc985fbb49f4d09b1e608661aefd60f",
            "8af64ff793c0417e94312e3f56880ba1":"dd88201d6da94db9b059d2cf987959e5",
            "60cc304472ac4281bbf8cf9ded571c3a":"6d06615ac78845e682cb45c98e4e0295",
            "35bd8d4f4f53400994fee104f406261a":"8d2285ec2c2f4a94a6ee8f83d5357acd",
            "beaef8290576491aaf82a031dcdca139":"e1a7b80083fc4f70bcea57ac46a55114",
            "59bdd057ddc840b8af6eef5e885026d1":"078ec642a77744249320e3b7edbd1ff2",
        }
        value = params.get(input_string)
        return value